package top.so.dao.impl;

import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import top.so.dao.AbstractBaseDao;
import top.so.dao.BlogCollectionDao;
import top.so.entity.BlogCollection;

import java.util.List;
@Repository
public class BlogCollectionDaoImpl extends AbstractBaseDao implements BlogCollectionDao {
    public List<BlogCollection> selectWithPage(BlogCollection blogCollection,int pageNum) {
        PageHelper.startPage(pageNum,6);
        return this.getSqlSession().selectList(this.getClass().getName()+".selectAll",blogCollection);
    }

    public boolean insertCollection(BlogCollection blogCollection) {
        if(this.getSqlSession().insert(this.getClass().getName()+".insert",blogCollection)==1){
            return true;
        }
        return false;
    }

    public boolean deleteCollection(BlogCollection blogCollection) {
        if(this.getSqlSession().delete(this.getClass().getName()+".delete",blogCollection)==1){
        return true;
        }
        return false;
    }
}
